package com.example.myapplicationdemo01;

import com.example.myapplicationdemo01.slice.MainAbilitySlice;
import com.example.myapplicationdemo01.slice.MainAbilitySlice2;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;

public class MainAbility extends Ability {
    /**
     * 当系统⾸次创建当前PageAbility实例时，⾃动调⽤onstart⽅法。也就是说对于⼀个Page⽽⾔，onStart⽅法只会执⾏⼀次
     * @param intent ss
     */
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setMainRoute(MainAbilitySlice.class.getName());
        System.out.println("---------OnStart");
    }

    /**
     * 当前Page进⼊active状态进⼊到⼿机前台获取焦点时，会触发onActive⽅法的执⾏
     */
    @Override
    protected void onActive() {
        super.onActive();
        System.out.println("---------OnActive");
    }

    /**
     * 当前PageAbility失去焦点（⻚⾯切⼊到后台、切换到其他Page、或者在当前界面弹出小窗口也会失去焦点），
     * 触发onInactive⽅法的执⾏
     */
    @Override
    protected void onInactive() {
        super.onInactive();
        System.out.println("---------onInactive");
    }

    /**
     * 当前PageAbility切换到后台，不可⻅时，触发onBackground执⾏
     */
    @Override
    protected void onBackground() {
        super.onBackground();
        System.out.println("---------onBackground");
    }

    /**
     * 当PageAbility从后台不可⻅状态（⻚⾯在后台、但是没销毁）切换到前台可⻅状态时触发 onForeground执⾏
     */
    @Override
    protected void onForeground(Intent intent) {
        super.onForeground(intent);
        System.out.println("---------onForeground");
    }
    /**
     * 当前Page销毁时，触发onStop的执⾏
     */
    @Override
    protected void onStop() {
        super.onStop();
        System.out.println("---------onStop");
    }


}
